#include <iostream>
#include<cstdlib>
#include<ctime>

#include "functions.h"

#define TESTRANDOM

using namespace std;

size_t random(size_t count){

    return static_cast<size_t>(rand() / (RAND_MAX / count + 1));

}

int main2()
{
    const int a {10} , b {5} ;
    int result {};
    const size_t num_functions {3};
    srand(static_cast<unsigned>(time(nullptr)));

    for(size_t i{};i<5;i++){

        size_t select = random(num_functions);
        #ifdef TESTRANDOM
            cout<<"Random number = " << select << ' ';
            if(select >= num_functions){
                cout<<"Invalid random number generated!"<<endl;
                return 1;
            }
        #endif // TESTRANDOM
        switch(select){
            case 0 : result = fun::sum(a,b);break;
            case 1 : result = fun::product(a,b);break;
            case 2 : result = fun::difference(a,b);break;
        }
            cout<<"result = " << result << endl;
    }

    return 0;
}
